﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls">

    <Style TargetType="Controls:Tile">
        <Setter Property="Width"
                Value="140" />
        <Setter Property="Height"
                Value="140" />
        <Setter Property="Margin"
                Value="3" />
        <Setter Property="Foreground"
                Value="White" />
        <Setter Property="Background"
                Value="{DynamicResource AccentColorBrush}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="RenderTransformOrigin"
                Value="0.5,0.5" />
        <Setter Property="TitleFontSize"
                Value="16"/>
        <Setter Property="CountFontSize"
                Value="28"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:Tile">
                    <Grid Background="{TemplateBinding Background}">
                        <StackPanel VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    Orientation="Horizontal">
                            <ContentPresenter RecognizesAccessKey="True" />
                            <TextBlock Text="{TemplateBinding Count}"
                                       FontSize="{Binding CountFontSize, RelativeSource={RelativeSource TemplatedParent}}"
                                       VerticalAlignment="Center" />
                        </StackPanel>

                        <Label Grid.ColumnSpan="2"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Bottom"
                               Foreground="{TemplateBinding Foreground}">
                            <AccessText Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}"
                                        Foreground="{TemplateBinding Foreground}"
                                        TextWrapping="Wrap"
                                        FontSize="{Binding TitleFontSize, RelativeSource={RelativeSource TemplatedParent}}"
                                        Margin="3" />
                        </Label>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button.IsPressed"
                                 Value="True">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="0.98"
                                                    ScaleY="0.98"
                                                    CenterX="0.5"
                                                    CenterY="0.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
